import numpy as np
import matplotlib.pyplot as plt

azimuth=np.linspace(-180,180,1441)
experimenthh=np.loadtxt('experiment,hh.txt')[:,1]+20*np.log10(15)
experimentvv=np.loadtxt('experiment,vv.txt')[:,1]+20*np.log10(15)
calhh=np.loadtxt('frequency 0.000667GHz,elevation 0.0deg,hh.txt')[:,1]-60+3
calvv=np.loadtxt('frequency 0.000667GHz,elevation 0.0deg,vv.txt')[:,1]-60+3
print(calhh.mean()-experimenthh.mean())
print(calvv.mean()-experimentvv.mean())
print(10*np.log10((10**(calhh/10)).mean())-10*np.log10((10**(experimenthh/10)).mean()))
print(10*np.log10((10**(calvv/10)).mean())-10*np.log10((10**(experimentvv/10)).mean()))
plt.figure()
plt.plot(azimuth,calhh,label='HH, Calculate',lw=.5)
plt.plot(azimuth,experimenthh,label='HH, Experiment',lw=.5)

plt.legend()
plt.savefig('hh.png')
plt.close()
plt.figure()
plt.plot(azimuth,calvv,label='VV, Calculate',lw=.5)
plt.plot(azimuth,experimentvv,label='VV, Experiment',lw=.5)
plt.legend()
plt.savefig('vv.png')
plt.close()

def showCode():
    with open(__file__) as f:
        return f.read()






